From aaa68954c34a31fb95b717f2fed6736037e0d644 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 15 Jul 2021 13:14:13 -0400 Subject: [PATCH] snapshot: Handle transparent opacity nodes correctly Eliding totally transparent content from the node tree is not 100% correct, since filters can make things visible, so we need to at least preserve the bounds. We can do that by creating a transparent color node. --- gtk/gtksnapshot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index b0b1222c66..ad5533982a 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -30,6 +30,8 @@ #include "gtkstylecontextprivate.h" #include "gsktransformprivate.h" +#include "gdk/gdkrgbaprivate.h" + #include "gsk/gskrendernodeprivate.h" #include "gsk/gskroundedrectprivate.h" @@ -461,8 +463,12 @@ gtk_snapshot_collect_opacity (GtkSnapshot *snapshot, } else if (state->data.opacity.opacity == 0.0) { + GdkRGBA color = GDK_RGBA ("00000000"); + graphene_rect_t bounds; + + gsk_render_node_get_bounds (node, &bounds); + opacity_node = gsk_color_node_new (&color, &bounds); gsk_render_node_unref (node); - opacity_node = NULL; } else { -- 2.30.2